JavaScript

A5.chart.uvalue Method

Syntax

A5.chart.u.value(data,dimension,value[,length])

Returns

valuenumberarray

The resulting value.

Description

The value utility method is used to convert an absolute value on a given dimension into a relative value.

Discussion

When a value is being drawn, it will need to be converted from the context of the dimension it is on to the chart plot area. The chart data mapping process and render axis creation will result in a dimension's min and max values being defined. This method will take an arbitrary "value" on a "dimension", and return a value between "0" and the "length". This can then be used to place content on the chart at a given "value" without the need to do additional calculations.

Example

// assume the chart is a rectangular chart
// "y" values between -15 and 25, and "data" is chart render data
var v = A5.chart.u.value(data,'y',5,650);
// v = 325

Properties

dataobject

The chart render data object. See A5.chart Render Data Object.

dimensionstringarray

The dimension(s) the value(s) on. Multiple dimensions can be gotten by passing in an array of dimension names.

valueanyarray

The value(s).

lengthnumberarray

The length(s) to use for the dimension(s). The default is "100" (e.g. a percentage location).